package com.dayuanit.pay.bank.factory;

import java.util.Map;

import com.dayuanit.pay.bank.handler.PayBaseHandler;
import com.dayuanit.pay.exception.MallBusException;

public class PayHandlerFactory {
	
	private Map<Integer, PayBaseHandler> payHandler;
	
	public void setPayHandler(Map<Integer, PayBaseHandler> payHandler) {
		this.payHandler = payHandler;
	}

	public PayBaseHandler getHandler(int payChannel) {
		PayBaseHandler pbh = payHandler.get(payChannel);
		if (null == pbh) {
			throw new MallBusException("无效的支付通道");
		}
		return pbh;
	}

}
